const fs = require('fs');
module.exports = {
  "title": "凯的个人博客", //这里是博客标题
  "description": "blog",  //博客描述
  "dest": "public", //博客部署时输出的文件夹
  "head": [
    [
      "link",
      {
        "rel": "icon",
        "href": "/favicon.ico"
      }
    ],
    [
      "meta",
      {
        "name": "viewport",
        "content": "width=device-width,initial-scale=1,user-scalable=no"
      }
    ]
  ],
  "theme": "reco",
  "themeConfig": {
    // footer: '/footer.html',
    "nav": [
      {
        "text": "首页",
        "link": "/",
        "icon": "reco-home"
      },
      // {
      //   "text": "TimeLine",
      //   "link": "/timeline/",
      //   "icon": "reco-date"
      // },
      {
        "text": "消息栏",
        "icon": "reco-message",
        "items": [
          {
            "text": "vuepress-reco",
            "link": "/docs/theme-reco/"
          }
        ]
      },
      {
        "text": "github链接",
        "icon": "reco-message",
        "items": [
          {
            "text": "GitHub",
            "link": "https://github.com/recoluan",
            "icon": "reco-github"
          }
        ]
      }
    ],
    //侧边栏设置
    "sidebar": {
      "/docs/theme-reco/": [
        "",
        "theme",
        "plugin",
        "api"
      ],
      "/blogs/Front/html/":getSideBar('html'),
      "/blogs/Front/css/":getSideBar('css'),
      "/blogs/Front/react/":getSideBar('react'),
      "/blogs/Front/js/":getSideBar('js'),
      "/blogs/Front/ts/":getSideBar('ts')
    },
    "type": "blog",
    "blogConfig": {
      "category": {
        "location": 2,
        "text": "前端技术"
      },
      "tag": {
        "location": 3,
        "text": "Tag"
      }
    },
    "friendLink": [
      {
        "title": "新浪微博",
        "desc": "跳转到新浪微博",
        "email": "1156743527@qq.com",
        "link": "https://www.recoluan.com"
      },
      {
        "title": "qq空间",
        "desc": "跳转到qq空间",
        "avatar": "https://vuepress-theme-reco.recoluan.com/icon_vuepress_reco.png",
        "link": "https://user.qzone.qq.com/359551826/infocenter"
      }
    ],
    "logo": "/logo.jpg",
    "search": true,
    "searchMaxSuggestions": 10,
    "lastUpdated": "Last Updated",
    "author": "凯",
    "authorAvatar": "/avatar.jpg",
    "record": "闽ICP备2024053055号",
    "startYear": "2024"
    
  },
  "markdown": {
    "lineNumbers": true
  },
  "plugins": [
    ['autobar'],
    [
      //鼠标点击特效 先安装在配置， npm install vuepress-plugin-cursor-effects --save
      "cursor-effects",
      {
        size: 3,                    // size of the particle, default: 2
        shape: ['circle'],  // shape of the particle, default: 'star'
        zIndex: 999999999           // z-index property of the canvas, default: 999999999
      }
    ],
  ]
  
}


// 自动获取侧边栏
function getSideBar(folder) {
    // 只能用绝对路径
    path = 'D:/VuePressProject/my-blog/blogs/Front/' + folder + '/';
    let file_list = fs.readdirSync(path);
    for (let i = 0; i < file_list.length; i++) {
        // 可根据需求定制文件名，但是不能有.md后缀
        file_list[i] = file_list[i].slice(0, -3);
    }
    return file_list;
}

// 自动获取导航栏
function getNav(folder) {
    // 只能用绝对路径
    path = 'D:/VuePressProject/my-blog/blogs/Front/' + folder + '/';
    let file_list = fs.readdirSync(path);
    let nav_text = [];
    for (let i = 0; i < file_list.length; i++) {
        nav_text.push({
            // 这里也可以根据需求定制，同样不能有后缀
            text: file_list[i].slice(0, -3),
            link: '/pages/' + folder + '/' + file_list[i].slice(0, -3)
            });
    }
    return nav_text;
}
